package servlet.image;

import bean.Result;
import com.google.gson.Gson;
import dao.ProductImage;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.UUID;

@WebServlet(name = "QueryImageServlet", value = "/QueryImageServlet.s")
public class QueryImageServlet extends HttpServlet {
    public static final String IMAGE_PATH = "D:\\web\\web-phase-ii-project\\src\\main\\webapp\\uploads\\";
    private ProductImage dao = new ProductImage();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        final String proid = request.getParameter("proid");
        Result result;
        //获取文件
        final List<Map<String, Object>> images = dao.queryImage(proid);

        final String json = new Gson().toJson(images);
        response.getWriter().append(json);
    }
}
